package gestionColis;

/**
 * Interface definition : GestAdherent
 * 
 * @author OpenORB Compiler
 */
public abstract class GestAdherentPOA extends org.omg.PortableServer.Servant
        implements GestAdherentOperations, org.omg.CORBA.portable.InvokeHandler
{
    public GestAdherent _this()
    {
        return GestAdherentHelper.narrow(_this_object());
    }

    public GestAdherent _this(org.omg.CORBA.ORB orb)
    {
        return GestAdherentHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:gestionColis/GestAdherent:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        if (opName.equals("adherentExiste")) {
                return _invoke_adherentExiste(_is, handler);
        } else if (opName.equals("enregistrerAdherent")) {
                return _invoke_enregistrerAdherent(_is, handler);
        } else if (opName.equals("inscrireAdherent")) {
                return _invoke_inscrireAdherent(_is, handler);
        } else if (opName.equals("notifierArriveeColis")) {
                return _invoke_notifierArriveeColis(_is, handler);
        } else {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke_inscrireAdherent(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionColis.InfoAdherent arg0_in = gestionColis.InfoAdherentHelper.read(_is);
        gestionColis.Adherent arg1_in = gestionColis.AdherentHelper.read(_is);

        try
        {
            inscrireAdherent(arg0_in, arg1_in);

            _output = handler.createReply();

        }
        catch (gestionColis.InfoAdherentInvalideException _exception)
        {
            _output = handler.createExceptionReply();
            gestionColis.InfoAdherentInvalideExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_notifierArriveeColis(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionColis.InfoColis arg0_in = gestionColis.InfoColisHelper.read(_is);

        try
        {
            notifierArriveeColis(arg0_in);

            _output = handler.createReply();

        }
        catch (gestionColis.AdherentInconnuException _exception)
        {
            _output = handler.createExceptionReply();
            gestionColis.AdherentInconnuExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_adherentExiste(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionColis.InfoAdherent arg0_in = gestionColis.InfoAdherentHelper.read(_is);

        try
        {
            String _arg_result = adherentExiste(arg0_in);

            _output = handler.createReply();
            _output.write_string(_arg_result);

        }
        catch (gestionColis.AdherentInconnuException _exception)
        {
            _output = handler.createExceptionReply();
            gestionColis.AdherentInconnuExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_enregistrerAdherent(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionColis.Adherent arg0_in = gestionColis.AdherentHelper.read(_is);

        enregistrerAdherent(arg0_in);

        _output = handler.createReply();

        return _output;
    }

}
